package com.sy.msgview.component

import androidx.compose.foundation.clickable
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.composed
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.layout.Layout
import androidx.compose.ui.layout.MeasurePolicy
import androidx.compose.ui.layout.layout
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.navigation.NavController
import coil.compose.AsyncImage
import com.sy.msgview.ui.theme.Pink40
import kotlin.math.min

fun Modifier.keepSquare() = layout { measurable, constraints ->
	val placeable = measurable.measure(constraints)
	val size = min(placeable.width, placeable.height)
	layout(size, size) {
		placeable.place(0, 0)
	}
}


fun Modifier.noRippleClickable(onClick: () -> Unit): Modifier = this.then(
	clickable(interactionSource = MutableInteractionSource(), indication = null, onClick = onClick)
)

fun Modifier.fillMaxSize(width: Float, height: Float): Modifier = this.then(
	fillMaxWidth(width).fillMaxHeight(height)
)

